import paddlehub as hub
from PIL import Image

# 载入模型
styleganv2_editing = hub.Module(name='styleganv2_editing')

# 图像路径
input_img = "./input.png"

# 模型预测
styleganv2_editing.generate(
    paths=[input_img], 
    direction_name = 'age', 
    direction_offset = 5.0, 
    output_dir='./editing_result/', 
    use_gpu=True, 
    visualization=True)

# 输出路径
output_img = "./editing_result/dst_0.png"